﻿if (typeof(Admin) == 'undefined')
    Admin = {};
if (typeof(Admin.Account) == 'undefined')
    Admin.Core = {};

Admin.Core = {
    Uploader: function (id, options) {
        var defaults = {
            element: document.getElementById(id),
            action: '../Core/Service/uploadImage.ashx',
            allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'],
            sizeLimit: 1024 * 254,
            minSizeLimit: 0,
            debug: true,
            onComplete: function (_id, fileName, responseJSON) {
                $("#" + id).attr("filename", responseJSON.name);
            }
        };
        option = $.extend({}, defaults, options);
        var uploader = new qq.FileUploader(option);
    },
    SelectedMenu: function () {
        var location = window.location.toString().toLowerCase();
        $("#topmenu ul li").each(function () {
            $(this).attr("class", "");
        });
        if (location.indexOf("user") != -1) {
            $("#user").attr("class", "current");
        }
        if (location.indexOf("product") != -1) {
            $("#product").attr("class", "current");
        }
        if (location.indexOf("order") != -1) {
            $("#order").attr("class", "current");
        }
        if (location.indexOf("news") != -1) {
            $("#news").attr("class", "current");
        }
    },
    Init: function () {
        this.SelectedMenu();
    }
}

$(function () {
    Admin.Core.Init();
});